From: Luca BRUNO Date: Tue, 7 Dec 2021 16:13:54 +0000 (+0000) Subject: lib/repo: assert that writable state and error agree X-Git-Tag: archive/raspbian/2022.1-3+rpi1^2~12^2^2~10^2~2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=f1e24945fa03c12417ba0e47fedc8e87c9c0a1f1;p=ostree.git lib/repo: assert that writable state and error agree This adds an assertion to check that writable stable and error are in sync. The subsequent logic uses them interchangeably. --- diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c index a9be9f94..85700b03 100644 --- a/src/libostree/ostree-repo.c +++ b/src/libostree/ostree-repo.c @@ -1560,8 +1560,10 @@ gboolean ostree_repo_is_writable (OstreeRepo *self, GError **error) { - g_return_val_if_fail (self->inited, FALSE); + g_assert (self != NULL); + g_assert (self->inited); + g_assert (self->writable == (self->writable_error == NULL)); if (error != NULL && self->writable_error != NULL) *error = g_error_copy (self->writable_error);